Splash Screen


Splash screen is a temporary window that appears befor applications completed loading
into memory. Most large applications have splash screen such as Delphi. Splash screen
always used for large applications and for any application that has a long initialization
time such as openning databases. When you use database in your Delphi application
and you open a table at main form's-OnCreate event, initializing BDE for openning
table at first time takes long time so that instead of letting user keep watching
hard disk led and hearing it's heads while your application loaded, it is better
to display a splash screen to make him feel that your application is working.

In splash screen you can write some information about your application such as application
name, version, date, copyright, and your company name or your name if you are individual.

Build splash screen:

- Start new application.
- Add new form (should be Form2).
- Set Form2
BorderStyle to bsNone.
- Set Form2
Position property to poScreenCenter.
- Drop a
Panel in Form2 and make it's Align to alClient.
- At main form (Form1)
OnCreate event write:

 Sleep(2000);

This delay simulate application initialization and loading.

- View project file (you can display it by pressing Ctrl + F12 then selecting Project1).
- Project1 code must as text below, new added lines are written in bold face (You
can replace Project1 code by below code), you must clear auto-creation for Form2
by one of two methods:

1. At Delphi main menu select (Project/Options/Forms) then remove Form2 from
Auto-create
forms
to Available forms.

2. Also you can delete below line from Project1 file:

 Application.CreateForm(TForm2, Form2);



program Project1;

uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};

{$R *.RES}

var
Form2: TForm2;

begin
 Form2:= TForm2.Create(nil);
Form2.Show;
Form2.Update;
 Application.Initialize;
Application.CreateForm(TForm1, Form1);
 Form2.Free;
 Application.Run;
end.


See also:

Example 001: Easy Note